extends PanelContainer

@export var notification_type:GlobalVariables.NOTIFICATION_TYPE = GlobalVariables.NOTIFICATION_TYPE.INFO
@export var msg:String
@onready var type_icon = $HBoxContainer/PanelContainer/HBoxContainer/type_icon
@onready var msg_label = $HBoxContainer/PanelContainer/HBoxContainer/msg_label
@onready var time_label = $HBoxContainer/PanelContainer/HBoxContainer/time_label
@onready var timer = %Timer

@export var info_texture:Texture2D
@export var warning_texture:Texture2D
@export var error_texture:Texture2D

# Called when the node enters the scene tree for the first time.
func _ready():
	#设置类型
	match notification_type:
		GlobalVariables.NOTIFICATION_TYPE.INFO:
			type_icon.texture = info_texture
		GlobalVariables.NOTIFICATION_TYPE.WARNING:
			type_icon.texture = warning_texture
		GlobalVariables.NOTIFICATION_TYPE.ERROR:	
			type_icon.texture = error_texture
	
	msg_label.text = msg
	time_label.text = Time.get_datetime_string_from_system().replace('T','\n')

func _on_close_btn_pressed():
	self.queue_free()


func _on_timer_timeout():
	self.queue_free()
